package com.wbk.lotterysystemsystemservice.controller;

import com.wbk.lotterysystemsystemservice.common.bo.AdminLoginBO;
import com.wbk.lotterysystemsystemservice.common.dto.AdminLoginDTO;
import com.wbk.lotterysystemsystemservice.controller.biz.AdminLoginBiz;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import result.Result;

import javax.validation.Valid;

@Api
@RestController
@RequestMapping("/user/api/user")
public class AdminLoginController {

    @Autowired
    AdminLoginBiz adminLoginBiz;

    @ApiOperation(value = "管理员登录接口", notes = "管理员登录")
    @PostMapping("/login")
    public Result<AdminLoginDTO> login(@Valid @RequestBody AdminLoginBO adminLoginBO) {
        return adminLoginBiz.login(adminLoginBO);
    }

    @ApiOperation(value = "解析token接口", notes = "解析token")
    @GetMapping("/testToken")
    public Result<AdminLoginDTO> token(@RequestHeader("token") String token) {
        return adminLoginBiz.token(token);
    }
}
